{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 运用微软Azure API识别图片人脸数据"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##### 第一张图片（甄嬛三人组）\n",
    "![甄嬛三人组](https://ss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=2229001182,108501940&fm=26&gp=0.jpg)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 152,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[{'faceId': '5df54b0f-0f8c-412c-a7c4-0858f03b8877',\n",
       "  'faceRectangle': {'top': 112, 'left': 323, 'width': 47, 'height': 47},\n",
       "  'faceAttributes': {'gender': 'female',\n",
       "   'age': 25.0,\n",
       "   'glasses': 'NoGlasses',\n",
       "   'emotion': {'anger': 0.0,\n",
       "    'contempt': 0.0,\n",
       "    'disgust': 0.0,\n",
       "    'fear': 0.0,\n",
       "    'happiness': 0.0,\n",
       "    'neutral': 0.976,\n",
       "    'sadness': 0.024,\n",
       "    'surprise': 0.0}}},\n",
       " {'faceId': 'eecab38f-8000-46fc-845a-600241c1dee1',\n",
       "  'faceRectangle': {'top': 89, 'left': 195, 'width': 43, 'height': 43},\n",
       "  'faceAttributes': {'gender': 'female',\n",
       "   'age': 24.0,\n",
       "   'glasses': 'NoGlasses',\n",
       "   'emotion': {'anger': 0.0,\n",
       "    'contempt': 0.0,\n",
       "    'disgust': 0.0,\n",
       "    'fear': 0.0,\n",
       "    'happiness': 0.0,\n",
       "    'neutral': 0.999,\n",
       "    'sadness': 0.001,\n",
       "    'surprise': 0.0}}},\n",
       " {'faceId': '28221adc-e4e7-4cf1-ab24-d130dd8640ac',\n",
       "  'faceRectangle': {'top': 113, 'left': 88, 'width': 43, 'height': 43},\n",
       "  'faceAttributes': {'gender': 'female',\n",
       "   'age': 21.0,\n",
       "   'glasses': 'NoGlasses',\n",
       "   'emotion': {'anger': 0.0,\n",
       "    'contempt': 0.0,\n",
       "    'disgust': 0.0,\n",
       "    'fear': 0.0,\n",
       "    'happiness': 0.0,\n",
       "    'neutral': 0.999,\n",
       "    'sadness': 0.001,\n",
       "    'surprise': 0.0}}}]"
      ]
     },
     "execution_count": 152,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import requests\n",
    "import json\n",
    "\n",
    "KEY = '9c72e39c790c441b9d498ac86e6e7b22'  # Replace with a valid Subscription Key here.\n",
    "\n",
    "# Base URL,  Request URL中 \n",
    "BASE_URL = 'https://westcentralus.api.cognitive.microsoft.com/face/v1.0/detect' \n",
    "\n",
    "# 沿用API的示范代碼，{subscription key}用KEY代入\n",
    "HEADERS = {\n",
    "    # Request headers\n",
    "    'Content-Type': 'application/json',\n",
    "    'Ocp-Apim-Subscription-Key': '{}'.format(KEY),\n",
    "}\n",
    "\n",
    "img_url = 'https://ss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=2229001182,108501940&fm=26&gp=0.jpg'\n",
    "\n",
    "data = {\n",
    "    'url': '{}'.format(img_url),\n",
    "}\n",
    "payload = {\n",
    "    'returnFaceId': 'true',\n",
    "    'returnFaceLandmarks': 'flase',\n",
    "    'returnFaceAttributes': '{}'.format('age,gender,glasses,emotion'), \n",
    "}\n",
    "\n",
    "# 坑。参考http://docs.python-requests.org/zh_CN/latest/user/quickstart.html  【更加复杂的post请求】\n",
    "# 差別是 string 字串 vs. dict 字典\n",
    "# Azura 使用的是 data = json.dumps(payload) 或 json=payload，data = payload 会出错\n",
    "r = requests.post(BASE_URL, data=json.dumps(data), params=payload, headers=HEADERS)\n",
    "\n",
    "r.status_code\n",
    "result = r.json()\n",
    "result"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 153,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>faceAttributes.age</th>\n",
       "      <th>faceAttributes.emotion.anger</th>\n",
       "      <th>faceAttributes.emotion.contempt</th>\n",
       "      <th>faceAttributes.emotion.disgust</th>\n",
       "      <th>faceAttributes.emotion.fear</th>\n",
       "      <th>faceAttributes.emotion.happiness</th>\n",
       "      <th>faceAttributes.emotion.neutral</th>\n",
       "      <th>faceAttributes.emotion.sadness</th>\n",
       "      <th>faceAttributes.emotion.surprise</th>\n",
       "      <th>faceAttributes.gender</th>\n",
       "      <th>faceAttributes.glasses</th>\n",
       "      <th>faceId</th>\n",
       "      <th>faceRectangle.height</th>\n",
       "      <th>faceRectangle.left</th>\n",
       "      <th>faceRectangle.top</th>\n",
       "      <th>faceRectangle.width</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>25.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.976</td>\n",
       "      <td>0.024</td>\n",
       "      <td>0.0</td>\n",
       "      <td>female</td>\n",
       "      <td>NoGlasses</td>\n",
       "      <td>5df54b0f-0f8c-412c-a7c4-0858f03b8877</td>\n",
       "      <td>47</td>\n",
       "      <td>323</td>\n",
       "      <td>112</td>\n",
       "      <td>47</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>24.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.999</td>\n",
       "      <td>0.001</td>\n",
       "      <td>0.0</td>\n",
       "      <td>female</td>\n",
       "      <td>NoGlasses</td>\n",
       "      <td>eecab38f-8000-46fc-845a-600241c1dee1</td>\n",
       "      <td>43</td>\n",
       "      <td>195</td>\n",
       "      <td>89</td>\n",
       "      <td>43</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>21.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.999</td>\n",
       "      <td>0.001</td>\n",
       "      <td>0.0</td>\n",
       "      <td>female</td>\n",
       "      <td>NoGlasses</td>\n",
       "      <td>28221adc-e4e7-4cf1-ab24-d130dd8640ac</td>\n",
       "      <td>43</td>\n",
       "      <td>88</td>\n",
       "      <td>113</td>\n",
       "      <td>43</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   faceAttributes.age  faceAttributes.emotion.anger  \\\n",
       "0                25.0                           0.0   \n",
       "1                24.0                           0.0   \n",
       "2                21.0                           0.0   \n",
       "\n",
       "   faceAttributes.emotion.contempt  faceAttributes.emotion.disgust  \\\n",
       "0                              0.0                             0.0   \n",
       "1                              0.0                             0.0   \n",
       "2                              0.0                             0.0   \n",
       "\n",
       "   faceAttributes.emotion.fear  faceAttributes.emotion.happiness  \\\n",
       "0                          0.0                               0.0   \n",
       "1                          0.0                               0.0   \n",
       "2                          0.0                               0.0   \n",
       "\n",
       "   faceAttributes.emotion.neutral  faceAttributes.emotion.sadness  \\\n",
       "0                           0.976                           0.024   \n",
       "1                           0.999                           0.001   \n",
       "2                           0.999                           0.001   \n",
       "\n",
       "   faceAttributes.emotion.surprise faceAttributes.gender  \\\n",
       "0                              0.0                female   \n",
       "1                              0.0                female   \n",
       "2                              0.0                female   \n",
       "\n",
       "  faceAttributes.glasses                                faceId  \\\n",
       "0              NoGlasses  5df54b0f-0f8c-412c-a7c4-0858f03b8877   \n",
       "1              NoGlasses  eecab38f-8000-46fc-845a-600241c1dee1   \n",
       "2              NoGlasses  28221adc-e4e7-4cf1-ab24-d130dd8640ac   \n",
       "\n",
       "   faceRectangle.height  faceRectangle.left  faceRectangle.top  \\\n",
       "0                    47                 323                112   \n",
       "1                    43                 195                 89   \n",
       "2                    43                  88                113   \n",
       "\n",
       "   faceRectangle.width  \n",
       "0                   47  \n",
       "1                   43  \n",
       "2                   43  "
      ]
     },
     "execution_count": 153,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pandas as pd\n",
    "from pandas.io.json import json_normalize\n",
    "df = pd.io.json.json_normalize(result)\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 154,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>年龄</th>\n",
       "      <th>生气</th>\n",
       "      <th>蔑视</th>\n",
       "      <th>厌恶</th>\n",
       "      <th>恐惧</th>\n",
       "      <th>高兴</th>\n",
       "      <th>平静</th>\n",
       "      <th>伤心</th>\n",
       "      <th>惊讶</th>\n",
       "      <th>性别</th>\n",
       "      <th>眼镜</th>\n",
       "      <th>faceId</th>\n",
       "      <th>faceRectangle.height</th>\n",
       "      <th>faceRectangle.left</th>\n",
       "      <th>faceRectangle.top</th>\n",
       "      <th>faceRectangle.width</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>25.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.976</td>\n",
       "      <td>0.024</td>\n",
       "      <td>0.0</td>\n",
       "      <td>女性</td>\n",
       "      <td>没戴眼镜</td>\n",
       "      <td>5df54b0f-0f8c-412c-a7c4-0858f03b8877</td>\n",
       "      <td>47</td>\n",
       "      <td>323</td>\n",
       "      <td>112</td>\n",
       "      <td>47</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>24.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.999</td>\n",
       "      <td>0.001</td>\n",
       "      <td>0.0</td>\n",
       "      <td>女性</td>\n",
       "      <td>没戴眼镜</td>\n",
       "      <td>eecab38f-8000-46fc-845a-600241c1dee1</td>\n",
       "      <td>43</td>\n",
       "      <td>195</td>\n",
       "      <td>89</td>\n",
       "      <td>43</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>21.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.999</td>\n",
       "      <td>0.001</td>\n",
       "      <td>0.0</td>\n",
       "      <td>女性</td>\n",
       "      <td>没戴眼镜</td>\n",
       "      <td>28221adc-e4e7-4cf1-ab24-d130dd8640ac</td>\n",
       "      <td>43</td>\n",
       "      <td>88</td>\n",
       "      <td>113</td>\n",
       "      <td>43</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "     年龄   生气   蔑视   厌恶   恐惧   高兴     平静     伤心   惊讶  性别    眼镜  \\\n",
       "0  25.0  0.0  0.0  0.0  0.0  0.0  0.976  0.024  0.0  女性  没戴眼镜   \n",
       "1  24.0  0.0  0.0  0.0  0.0  0.0  0.999  0.001  0.0  女性  没戴眼镜   \n",
       "2  21.0  0.0  0.0  0.0  0.0  0.0  0.999  0.001  0.0  女性  没戴眼镜   \n",
       "\n",
       "                                 faceId  faceRectangle.height  \\\n",
       "0  5df54b0f-0f8c-412c-a7c4-0858f03b8877                    47   \n",
       "1  eecab38f-8000-46fc-845a-600241c1dee1                    43   \n",
       "2  28221adc-e4e7-4cf1-ab24-d130dd8640ac                    43   \n",
       "\n",
       "   faceRectangle.left  faceRectangle.top  faceRectangle.width  \n",
       "0                 323                112                   47  \n",
       "1                 195                 89                   43  \n",
       "2                  88                113                   43  "
      ]
     },
     "execution_count": 154,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = df.rename ( columns = {\"faceAttributes.gender\":\"性别\", \n",
    "                       \"faceAttributes.age\":\"年龄\",\n",
    "                       \"faceAttributes.glasses\":\"眼镜\",\n",
    "                       \"faceAttributes.emotion.anger\":\"生气\",\n",
    "                       \"faceAttributes.emotion.contempt\":\"蔑视\",\n",
    "                       \"faceAttributes.emotion.disgust\":\"厌恶\",\n",
    "                       \"faceAttributes.emotion.fear\":\"恐惧\",\n",
    "                       \"faceAttributes.emotion.happiness\":\"高兴\",\n",
    "                       \"faceAttributes.emotion.neutral\":\"平静\",\n",
    "                       \"faceAttributes.emotion.sadness\":\"伤心\",\n",
    "                       \"faceAttributes.emotion.surprise\":\"惊讶\",} )\n",
    "df.replace({\"male\":\"男性\",\n",
    "               \"female\":\"女性\",\n",
    "              \"NoGlasses\":\"没戴眼镜\",\n",
    "              \"ReadingGlasses\":\"戴眼镜\",})"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##### 第二张图片（罗晋单人） \n",
    "![罗晋](https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=1411602682,2410414435&fm=26&gp=0.jpg)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[{'faceId': '5cef1718-3c5a-4cf2-8a94-d5370a10adf0',\n",
       "  'faceRectangle': {'top': 130, 'left': 103, 'width': 56, 'height': 56},\n",
       "  'faceAttributes': {'gender': 'male',\n",
       "   'age': 28.0,\n",
       "   'glasses': 'NoGlasses',\n",
       "   'emotion': {'anger': 0.0,\n",
       "    'contempt': 0.0,\n",
       "    'disgust': 0.0,\n",
       "    'fear': 0.0,\n",
       "    'happiness': 0.988,\n",
       "    'neutral': 0.011,\n",
       "    'sadness': 0.0,\n",
       "    'surprise': 0.0}}}]"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import requests\n",
    "import json\n",
    "\n",
    "KEY = '9c72e39c790c441b9d498ac86e6e7b22'  # Replace with a valid Subscription Key here.\n",
    "\n",
    "# Base URL,  Request URL中 \n",
    "BASE_URL = 'https://westcentralus.api.cognitive.microsoft.com/face/v1.0/detect' \n",
    "\n",
    "# 沿用API的示范代碼，{subscription key}用KEY代入\n",
    "HEADERS = {\n",
    "    # Request headers\n",
    "    'Content-Type': 'application/json',\n",
    "    'Ocp-Apim-Subscription-Key': '{}'.format(KEY),\n",
    "}\n",
    "\n",
    "img_url = 'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=1411602682,2410414435&fm=26&gp=0.jpg'\n",
    "\n",
    "data = {\n",
    "    'url': '{}'.format(img_url),\n",
    "}\n",
    "payload = {\n",
    "    'returnFaceId': 'true',\n",
    "    'returnFaceLandmarks': 'flase',\n",
    "    'returnFaceAttributes': '{}'.format('age,gender,glasses,emotion'), \n",
    "}\n",
    "\n",
    "# 坑。参考http://docs.python-requests.org/zh_CN/latest/user/quickstart.html  【更加复杂的post请求】\n",
    "# 差別是 string 字串 vs. dict 字典\n",
    "# Azura 使用的是 data = json.dumps(payload) 或 json=payload，data = payload 会出错\n",
    "r = requests.post(BASE_URL, data=json.dumps(data), params=payload, headers=HEADERS)\n",
    "\n",
    "r.status_code\n",
    "result = r.json()\n",
    "result"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>faceAttributes.age</th>\n",
       "      <th>faceAttributes.emotion.anger</th>\n",
       "      <th>faceAttributes.emotion.contempt</th>\n",
       "      <th>faceAttributes.emotion.disgust</th>\n",
       "      <th>faceAttributes.emotion.fear</th>\n",
       "      <th>faceAttributes.emotion.happiness</th>\n",
       "      <th>faceAttributes.emotion.neutral</th>\n",
       "      <th>faceAttributes.emotion.sadness</th>\n",
       "      <th>faceAttributes.emotion.surprise</th>\n",
       "      <th>faceAttributes.gender</th>\n",
       "      <th>faceAttributes.glasses</th>\n",
       "      <th>faceId</th>\n",
       "      <th>faceRectangle.height</th>\n",
       "      <th>faceRectangle.left</th>\n",
       "      <th>faceRectangle.top</th>\n",
       "      <th>faceRectangle.width</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>28.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.988</td>\n",
       "      <td>0.011</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>male</td>\n",
       "      <td>NoGlasses</td>\n",
       "      <td>5cef1718-3c5a-4cf2-8a94-d5370a10adf0</td>\n",
       "      <td>56</td>\n",
       "      <td>103</td>\n",
       "      <td>130</td>\n",
       "      <td>56</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   faceAttributes.age  faceAttributes.emotion.anger  \\\n",
       "0                28.0                           0.0   \n",
       "\n",
       "   faceAttributes.emotion.contempt  faceAttributes.emotion.disgust  \\\n",
       "0                              0.0                             0.0   \n",
       "\n",
       "   faceAttributes.emotion.fear  faceAttributes.emotion.happiness  \\\n",
       "0                          0.0                             0.988   \n",
       "\n",
       "   faceAttributes.emotion.neutral  faceAttributes.emotion.sadness  \\\n",
       "0                           0.011                             0.0   \n",
       "\n",
       "   faceAttributes.emotion.surprise faceAttributes.gender  \\\n",
       "0                              0.0                  male   \n",
       "\n",
       "  faceAttributes.glasses                                faceId  \\\n",
       "0              NoGlasses  5cef1718-3c5a-4cf2-8a94-d5370a10adf0   \n",
       "\n",
       "   faceRectangle.height  faceRectangle.left  faceRectangle.top  \\\n",
       "0                    56                 103                130   \n",
       "\n",
       "   faceRectangle.width  \n",
       "0                   56  "
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pandas as pd\n",
    "from pandas.io.json import json_normalize\n",
    "df = pd.io.json.json_normalize(result)\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>年龄</th>\n",
       "      <th>生气</th>\n",
       "      <th>蔑视</th>\n",
       "      <th>厌恶</th>\n",
       "      <th>恐惧</th>\n",
       "      <th>高兴</th>\n",
       "      <th>平静</th>\n",
       "      <th>伤心</th>\n",
       "      <th>惊讶</th>\n",
       "      <th>性别</th>\n",
       "      <th>眼镜</th>\n",
       "      <th>faceId</th>\n",
       "      <th>faceRectangle.height</th>\n",
       "      <th>faceRectangle.left</th>\n",
       "      <th>faceRectangle.top</th>\n",
       "      <th>faceRectangle.width</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>28.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.988</td>\n",
       "      <td>0.011</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>男性</td>\n",
       "      <td>没戴眼镜</td>\n",
       "      <td>5cef1718-3c5a-4cf2-8a94-d5370a10adf0</td>\n",
       "      <td>56</td>\n",
       "      <td>103</td>\n",
       "      <td>130</td>\n",
       "      <td>56</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "     年龄   生气   蔑视   厌恶   恐惧     高兴     平静   伤心   惊讶  性别    眼镜  \\\n",
       "0  28.0  0.0  0.0  0.0  0.0  0.988  0.011  0.0  0.0  男性  没戴眼镜   \n",
       "\n",
       "                                 faceId  faceRectangle.height  \\\n",
       "0  5cef1718-3c5a-4cf2-8a94-d5370a10adf0                    56   \n",
       "\n",
       "   faceRectangle.left  faceRectangle.top  faceRectangle.width  \n",
       "0                 103                130                   56  "
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = df.rename ( columns = {\"faceAttributes.gender\":\"性别\", \n",
    "                       \"faceAttributes.age\":\"年龄\",\n",
    "                       \"faceAttributes.glasses\":\"眼镜\",\n",
    "                       \"faceAttributes.emotion.anger\":\"生气\",\n",
    "                       \"faceAttributes.emotion.contempt\":\"蔑视\",\n",
    "                       \"faceAttributes.emotion.disgust\":\"厌恶\",\n",
    "                       \"faceAttributes.emotion.fear\":\"恐惧\",\n",
    "                       \"faceAttributes.emotion.happiness\":\"高兴\",\n",
    "                       \"faceAttributes.emotion.neutral\":\"平静\",\n",
    "                       \"faceAttributes.emotion.sadness\":\"伤心\",\n",
    "                       \"faceAttributes.emotion.surprise\":\"惊讶\",} )\n",
    "df.replace({\"male\":\"男性\",\n",
    "               \"female\":\"女性\",\n",
    "              \"NoGlasses\":\"没戴眼镜\",\n",
    "              \"ReadingGlasses\":\"戴眼镜\",})"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##### 第三张图片（钟汉良）\n",
    "![钟汉良](https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=3457559742,841113978&fm=26&gp=0.jpg)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[{'faceId': '43d5c8f3-9a4a-43c8-81cd-46dec1a9214d',\n",
       "  'faceRectangle': {'top': 43, 'left': 388, 'width': 67, 'height': 67},\n",
       "  'faceAttributes': {'gender': 'male',\n",
       "   'age': 27.0,\n",
       "   'glasses': 'NoGlasses',\n",
       "   'emotion': {'anger': 0.0,\n",
       "    'contempt': 0.0,\n",
       "    'disgust': 0.0,\n",
       "    'fear': 0.0,\n",
       "    'happiness': 0.003,\n",
       "    'neutral': 0.997,\n",
       "    'sadness': 0.0,\n",
       "    'surprise': 0.0}}},\n",
       " {'faceId': 'ffbba8e5-810a-46e7-871f-484c1b02821c',\n",
       "  'faceRectangle': {'top': 52, 'left': 59, 'width': 64, 'height': 64},\n",
       "  'faceAttributes': {'gender': 'male',\n",
       "   'age': 28.0,\n",
       "   'glasses': 'NoGlasses',\n",
       "   'emotion': {'anger': 0.0,\n",
       "    'contempt': 0.001,\n",
       "    'disgust': 0.0,\n",
       "    'fear': 0.0,\n",
       "    'happiness': 0.036,\n",
       "    'neutral': 0.962,\n",
       "    'sadness': 0.0,\n",
       "    'surprise': 0.0}}},\n",
       " {'faceId': '9b2fe81a-0f44-41f1-b40a-e3d65bd32a7d',\n",
       "  'faceRectangle': {'top': 247, 'left': 57, 'width': 64, 'height': 64},\n",
       "  'faceAttributes': {'gender': 'male',\n",
       "   'age': 30.0,\n",
       "   'glasses': 'NoGlasses',\n",
       "   'emotion': {'anger': 0.0,\n",
       "    'contempt': 0.0,\n",
       "    'disgust': 0.0,\n",
       "    'fear': 0.0,\n",
       "    'happiness': 0.001,\n",
       "    'neutral': 0.998,\n",
       "    'sadness': 0.0,\n",
       "    'surprise': 0.0}}},\n",
       " {'faceId': '0b445cfc-1a64-423b-bdb9-8c46ea53ab66',\n",
       "  'faceRectangle': {'top': 253, 'left': 369, 'width': 62, 'height': 62},\n",
       "  'faceAttributes': {'gender': 'male',\n",
       "   'age': 25.0,\n",
       "   'glasses': 'NoGlasses',\n",
       "   'emotion': {'anger': 0.0,\n",
       "    'contempt': 0.0,\n",
       "    'disgust': 0.0,\n",
       "    'fear': 0.0,\n",
       "    'happiness': 0.997,\n",
       "    'neutral': 0.002,\n",
       "    'sadness': 0.0,\n",
       "    'surprise': 0.0}}},\n",
       " {'faceId': 'e4e6e638-b5e7-4c68-971e-89e94004f1e9',\n",
       "  'faceRectangle': {'top': 48, 'left': 230, 'width': 62, 'height': 62},\n",
       "  'faceAttributes': {'gender': 'male',\n",
       "   'age': 26.0,\n",
       "   'glasses': 'NoGlasses',\n",
       "   'emotion': {'anger': 0.0,\n",
       "    'contempt': 0.01,\n",
       "    'disgust': 0.0,\n",
       "    'fear': 0.0,\n",
       "    'happiness': 0.256,\n",
       "    'neutral': 0.733,\n",
       "    'sadness': 0.001,\n",
       "    'surprise': 0.0}}},\n",
       " {'faceId': '2a3bca37-ee74-425e-acdc-ffa1d46e1ddb',\n",
       "  'faceRectangle': {'top': 247, 'left': 218, 'width': 61, 'height': 61},\n",
       "  'faceAttributes': {'gender': 'male',\n",
       "   'age': 27.0,\n",
       "   'glasses': 'NoGlasses',\n",
       "   'emotion': {'anger': 0.0,\n",
       "    'contempt': 0.004,\n",
       "    'disgust': 0.0,\n",
       "    'fear': 0.0,\n",
       "    'happiness': 0.137,\n",
       "    'neutral': 0.859,\n",
       "    'sadness': 0.0,\n",
       "    'surprise': 0.0}}}]"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import requests\n",
    "import json\n",
    "\n",
    "KEY = '9c72e39c790c441b9d498ac86e6e7b22'  # Replace with a valid Subscription Key here.\n",
    "\n",
    "# Base URL,  Request URL中 \n",
    "BASE_URL = 'https://westcentralus.api.cognitive.microsoft.com/face/v1.0/detect' \n",
    "\n",
    "# 沿用API的示范代碼，{subscription key}用KEY代入\n",
    "HEADERS = {\n",
    "    # Request headers\n",
    "    'Content-Type': 'application/json',\n",
    "    'Ocp-Apim-Subscription-Key': '{}'.format(KEY),\n",
    "}\n",
    "\n",
    "img_url = 'https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=3457559742,841113978&fm=26&gp=0.jpg'\n",
    "\n",
    "data = {\n",
    "    'url': '{}'.format(img_url),\n",
    "}\n",
    "payload = {\n",
    "    'returnFaceId': 'true',\n",
    "    'returnFaceLandmarks': 'flase',\n",
    "    'returnFaceAttributes': '{}'.format('age,gender,glasses,emotion'), \n",
    "}\n",
    "\n",
    "# 坑。参考http://docs.python-requests.org/zh_CN/latest/user/quickstart.html  【更加复杂的post请求】\n",
    "# 差別是 string 字串 vs. dict 字典\n",
    "# Azura 使用的是 data = json.dumps(payload) 或 json=payload，data = payload 会出错\n",
    "r = requests.post(BASE_URL, data=json.dumps(data), params=payload, headers=HEADERS)\n",
    "\n",
    "r.status_code\n",
    "result = r.json()\n",
    "result"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>faceAttributes.age</th>\n",
       "      <th>faceAttributes.emotion.anger</th>\n",
       "      <th>faceAttributes.emotion.contempt</th>\n",
       "      <th>faceAttributes.emotion.disgust</th>\n",
       "      <th>faceAttributes.emotion.fear</th>\n",
       "      <th>faceAttributes.emotion.happiness</th>\n",
       "      <th>faceAttributes.emotion.neutral</th>\n",
       "      <th>faceAttributes.emotion.sadness</th>\n",
       "      <th>faceAttributes.emotion.surprise</th>\n",
       "      <th>faceAttributes.gender</th>\n",
       "      <th>faceAttributes.glasses</th>\n",
       "      <th>faceId</th>\n",
       "      <th>faceRectangle.height</th>\n",
       "      <th>faceRectangle.left</th>\n",
       "      <th>faceRectangle.top</th>\n",
       "      <th>faceRectangle.width</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>27.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.003</td>\n",
       "      <td>0.997</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>male</td>\n",
       "      <td>NoGlasses</td>\n",
       "      <td>43d5c8f3-9a4a-43c8-81cd-46dec1a9214d</td>\n",
       "      <td>67</td>\n",
       "      <td>388</td>\n",
       "      <td>43</td>\n",
       "      <td>67</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>28.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.001</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.036</td>\n",
       "      <td>0.962</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>male</td>\n",
       "      <td>NoGlasses</td>\n",
       "      <td>ffbba8e5-810a-46e7-871f-484c1b02821c</td>\n",
       "      <td>64</td>\n",
       "      <td>59</td>\n",
       "      <td>52</td>\n",
       "      <td>64</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>30.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.001</td>\n",
       "      <td>0.998</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>male</td>\n",
       "      <td>NoGlasses</td>\n",
       "      <td>9b2fe81a-0f44-41f1-b40a-e3d65bd32a7d</td>\n",
       "      <td>64</td>\n",
       "      <td>57</td>\n",
       "      <td>247</td>\n",
       "      <td>64</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>25.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.997</td>\n",
       "      <td>0.002</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>male</td>\n",
       "      <td>NoGlasses</td>\n",
       "      <td>0b445cfc-1a64-423b-bdb9-8c46ea53ab66</td>\n",
       "      <td>62</td>\n",
       "      <td>369</td>\n",
       "      <td>253</td>\n",
       "      <td>62</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>26.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.010</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.256</td>\n",
       "      <td>0.733</td>\n",
       "      <td>0.001</td>\n",
       "      <td>0.0</td>\n",
       "      <td>male</td>\n",
       "      <td>NoGlasses</td>\n",
       "      <td>e4e6e638-b5e7-4c68-971e-89e94004f1e9</td>\n",
       "      <td>62</td>\n",
       "      <td>230</td>\n",
       "      <td>48</td>\n",
       "      <td>62</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>27.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.004</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.137</td>\n",
       "      <td>0.859</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>male</td>\n",
       "      <td>NoGlasses</td>\n",
       "      <td>2a3bca37-ee74-425e-acdc-ffa1d46e1ddb</td>\n",
       "      <td>61</td>\n",
       "      <td>218</td>\n",
       "      <td>247</td>\n",
       "      <td>61</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   faceAttributes.age  faceAttributes.emotion.anger  \\\n",
       "0                27.0                           0.0   \n",
       "1                28.0                           0.0   \n",
       "2                30.0                           0.0   \n",
       "3                25.0                           0.0   \n",
       "4                26.0                           0.0   \n",
       "5                27.0                           0.0   \n",
       "\n",
       "   faceAttributes.emotion.contempt  faceAttributes.emotion.disgust  \\\n",
       "0                            0.000                             0.0   \n",
       "1                            0.001                             0.0   \n",
       "2                            0.000                             0.0   \n",
       "3                            0.000                             0.0   \n",
       "4                            0.010                             0.0   \n",
       "5                            0.004                             0.0   \n",
       "\n",
       "   faceAttributes.emotion.fear  faceAttributes.emotion.happiness  \\\n",
       "0                          0.0                             0.003   \n",
       "1                          0.0                             0.036   \n",
       "2                          0.0                             0.001   \n",
       "3                          0.0                             0.997   \n",
       "4                          0.0                             0.256   \n",
       "5                          0.0                             0.137   \n",
       "\n",
       "   faceAttributes.emotion.neutral  faceAttributes.emotion.sadness  \\\n",
       "0                           0.997                           0.000   \n",
       "1                           0.962                           0.000   \n",
       "2                           0.998                           0.000   \n",
       "3                           0.002                           0.000   \n",
       "4                           0.733                           0.001   \n",
       "5                           0.859                           0.000   \n",
       "\n",
       "   faceAttributes.emotion.surprise faceAttributes.gender  \\\n",
       "0                              0.0                  male   \n",
       "1                              0.0                  male   \n",
       "2                              0.0                  male   \n",
       "3                              0.0                  male   \n",
       "4                              0.0                  male   \n",
       "5                              0.0                  male   \n",
       "\n",
       "  faceAttributes.glasses                                faceId  \\\n",
       "0              NoGlasses  43d5c8f3-9a4a-43c8-81cd-46dec1a9214d   \n",
       "1              NoGlasses  ffbba8e5-810a-46e7-871f-484c1b02821c   \n",
       "2              NoGlasses  9b2fe81a-0f44-41f1-b40a-e3d65bd32a7d   \n",
       "3              NoGlasses  0b445cfc-1a64-423b-bdb9-8c46ea53ab66   \n",
       "4              NoGlasses  e4e6e638-b5e7-4c68-971e-89e94004f1e9   \n",
       "5              NoGlasses  2a3bca37-ee74-425e-acdc-ffa1d46e1ddb   \n",
       "\n",
       "   faceRectangle.height  faceRectangle.left  faceRectangle.top  \\\n",
       "0                    67                 388                 43   \n",
       "1                    64                  59                 52   \n",
       "2                    64                  57                247   \n",
       "3                    62                 369                253   \n",
       "4                    62                 230                 48   \n",
       "5                    61                 218                247   \n",
       "\n",
       "   faceRectangle.width  \n",
       "0                   67  \n",
       "1                   64  \n",
       "2                   64  \n",
       "3                   62  \n",
       "4                   62  \n",
       "5                   61  "
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pandas as pd\n",
    "from pandas.io.json import json_normalize\n",
    "df = pd.io.json.json_normalize(result)\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>年龄</th>\n",
       "      <th>生气</th>\n",
       "      <th>蔑视</th>\n",
       "      <th>厌恶</th>\n",
       "      <th>恐惧</th>\n",
       "      <th>高兴</th>\n",
       "      <th>平静</th>\n",
       "      <th>伤心</th>\n",
       "      <th>惊讶</th>\n",
       "      <th>性别</th>\n",
       "      <th>眼镜</th>\n",
       "      <th>faceId</th>\n",
       "      <th>faceRectangle.height</th>\n",
       "      <th>faceRectangle.left</th>\n",
       "      <th>faceRectangle.top</th>\n",
       "      <th>faceRectangle.width</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>27.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.003</td>\n",
       "      <td>0.997</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>男性</td>\n",
       "      <td>没戴眼镜</td>\n",
       "      <td>43d5c8f3-9a4a-43c8-81cd-46dec1a9214d</td>\n",
       "      <td>67</td>\n",
       "      <td>388</td>\n",
       "      <td>43</td>\n",
       "      <td>67</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>28.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.001</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.036</td>\n",
       "      <td>0.962</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>男性</td>\n",
       "      <td>没戴眼镜</td>\n",
       "      <td>ffbba8e5-810a-46e7-871f-484c1b02821c</td>\n",
       "      <td>64</td>\n",
       "      <td>59</td>\n",
       "      <td>52</td>\n",
       "      <td>64</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>30.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.001</td>\n",
       "      <td>0.998</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>男性</td>\n",
       "      <td>没戴眼镜</td>\n",
       "      <td>9b2fe81a-0f44-41f1-b40a-e3d65bd32a7d</td>\n",
       "      <td>64</td>\n",
       "      <td>57</td>\n",
       "      <td>247</td>\n",
       "      <td>64</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>25.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.997</td>\n",
       "      <td>0.002</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>男性</td>\n",
       "      <td>没戴眼镜</td>\n",
       "      <td>0b445cfc-1a64-423b-bdb9-8c46ea53ab66</td>\n",
       "      <td>62</td>\n",
       "      <td>369</td>\n",
       "      <td>253</td>\n",
       "      <td>62</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>26.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.010</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.256</td>\n",
       "      <td>0.733</td>\n",
       "      <td>0.001</td>\n",
       "      <td>0.0</td>\n",
       "      <td>男性</td>\n",
       "      <td>没戴眼镜</td>\n",
       "      <td>e4e6e638-b5e7-4c68-971e-89e94004f1e9</td>\n",
       "      <td>62</td>\n",
       "      <td>230</td>\n",
       "      <td>48</td>\n",
       "      <td>62</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>27.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.004</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.137</td>\n",
       "      <td>0.859</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>男性</td>\n",
       "      <td>没戴眼镜</td>\n",
       "      <td>2a3bca37-ee74-425e-acdc-ffa1d46e1ddb</td>\n",
       "      <td>61</td>\n",
       "      <td>218</td>\n",
       "      <td>247</td>\n",
       "      <td>61</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "     年龄   生气     蔑视   厌恶   恐惧     高兴     平静     伤心   惊讶  性别    眼镜  \\\n",
       "0  27.0  0.0  0.000  0.0  0.0  0.003  0.997  0.000  0.0  男性  没戴眼镜   \n",
       "1  28.0  0.0  0.001  0.0  0.0  0.036  0.962  0.000  0.0  男性  没戴眼镜   \n",
       "2  30.0  0.0  0.000  0.0  0.0  0.001  0.998  0.000  0.0  男性  没戴眼镜   \n",
       "3  25.0  0.0  0.000  0.0  0.0  0.997  0.002  0.000  0.0  男性  没戴眼镜   \n",
       "4  26.0  0.0  0.010  0.0  0.0  0.256  0.733  0.001  0.0  男性  没戴眼镜   \n",
       "5  27.0  0.0  0.004  0.0  0.0  0.137  0.859  0.000  0.0  男性  没戴眼镜   \n",
       "\n",
       "                                 faceId  faceRectangle.height  \\\n",
       "0  43d5c8f3-9a4a-43c8-81cd-46dec1a9214d                    67   \n",
       "1  ffbba8e5-810a-46e7-871f-484c1b02821c                    64   \n",
       "2  9b2fe81a-0f44-41f1-b40a-e3d65bd32a7d                    64   \n",
       "3  0b445cfc-1a64-423b-bdb9-8c46ea53ab66                    62   \n",
       "4  e4e6e638-b5e7-4c68-971e-89e94004f1e9                    62   \n",
       "5  2a3bca37-ee74-425e-acdc-ffa1d46e1ddb                    61   \n",
       "\n",
       "   faceRectangle.left  faceRectangle.top  faceRectangle.width  \n",
       "0                 388                 43                   67  \n",
       "1                  59                 52                   64  \n",
       "2                  57                247                   64  \n",
       "3                 369                253                   62  \n",
       "4                 230                 48                   62  \n",
       "5                 218                247                   61  "
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = df.rename ( columns = {\"faceAttributes.gender\":\"性别\", \n",
    "                       \"faceAttributes.age\":\"年龄\",\n",
    "                       \"faceAttributes.glasses\":\"眼镜\",\n",
    "                       \"faceAttributes.emotion.anger\":\"生气\",\n",
    "                       \"faceAttributes.emotion.contempt\":\"蔑视\",\n",
    "                       \"faceAttributes.emotion.disgust\":\"厌恶\",\n",
    "                       \"faceAttributes.emotion.fear\":\"恐惧\",\n",
    "                       \"faceAttributes.emotion.happiness\":\"高兴\",\n",
    "                       \"faceAttributes.emotion.neutral\":\"平静\",\n",
    "                       \"faceAttributes.emotion.sadness\":\"伤心\",\n",
    "                       \"faceAttributes.emotion.surprise\":\"惊讶\",} )\n",
    "df.replace({\"male\":\"男性\",\n",
    "               \"female\":\"女性\",\n",
    "              \"NoGlasses\":\"没戴眼镜\",\n",
    "              \"ReadingGlasses\":\"戴眼镜\",})"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##### Azure人脸识别小结：\n",
    "* Azure 的免费期限是7天，可以免信用卡认真，github pack申请成功之后可以免费注册azure账号\n",
    "* 每个人脸识别API都有针对图片中的人脸，给出一个编码，azure是faceID\n",
    "* azure对人脸的识别没有人数限制，一张图片中5，6个人都可以一一识别出来\n",
    "* 总的来说，Azure人脸识别的操作难点在于注册新的账号，其他倒没什么问题，也可能是上课的内容吸收比较好的缘故\n",
    "* 发现一个Bug，同一个人不同表情，预测年龄也会不一样，参考第三张（钟汉良）"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 运用face++ API识别图片人脸数据"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##### 第一张图片（三小只）\n",
    "![三小只](https://dss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=2604565815,280322145&fm=26&gp=0.jpg)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 169,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'request_id': '1586756125,a1006141-8c45-4884-a525-81069aba29f3',\n",
       " 'time_used': 290,\n",
       " 'faces': [{'face_token': '0bb7a688f91cdf81bfa59e16d2bc6776',\n",
       "   'face_rectangle': {'top': 117, 'left': 349, 'width': 41, 'height': 41},\n",
       "   'attributes': {'gender': {'value': 'Male'},\n",
       "    'age': {'value': 23},\n",
       "    'smile': {'value': 0.044, 'threshold': 50.0},\n",
       "    'emotion': {'anger': 0.0,\n",
       "     'disgust': 0.0,\n",
       "     'fear': 0.001,\n",
       "     'happiness': 0.002,\n",
       "     'neutral': 99.958,\n",
       "     'sadness': 0.039,\n",
       "     'surprise': 0.001}}},\n",
       "  {'face_token': 'd4f0df67b266996886fb83468c284898',\n",
       "   'face_rectangle': {'top': 119, 'left': 102, 'width': 40, 'height': 40},\n",
       "   'attributes': {'gender': {'value': 'Male'},\n",
       "    'age': {'value': 33},\n",
       "    'smile': {'value': 0.719, 'threshold': 50.0},\n",
       "    'emotion': {'anger': 0.0,\n",
       "     'disgust': 0.0,\n",
       "     'fear': 0.0,\n",
       "     'happiness': 0.0,\n",
       "     'neutral': 99.977,\n",
       "     'sadness': 0.019,\n",
       "     'surprise': 0.004}}},\n",
       "  {'face_token': 'fc5f7032d8645dfdc84f922558333e30',\n",
       "   'face_rectangle': {'top': 124, 'left': 204, 'width': 40, 'height': 40},\n",
       "   'attributes': {'gender': {'value': 'Male'},\n",
       "    'age': {'value': 24},\n",
       "    'smile': {'value': 5.784, 'threshold': 50.0},\n",
       "    'emotion': {'anger': 0.076,\n",
       "     'disgust': 0.007,\n",
       "     'fear': 0.005,\n",
       "     'happiness': 0.06,\n",
       "     'neutral': 99.213,\n",
       "     'sadness': 0.032,\n",
       "     'surprise': 0.608}}}],\n",
       " 'image_id': 'cHAKKpNrMNU9OO7iZJNcvw==',\n",
       " 'face_num': 3}"
      ]
     },
     "execution_count": 169,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 1、先导入为们需要的模块\n",
    "import requests\n",
    "import json\n",
    "\n",
    "api_secret = \"Mg-S0entZbf1iVCBFAgM__d2TOeakTNZ\"\n",
    "# 2、输入我们API_Key\n",
    "api_key = 'aenENjllcy4-fqzCka_HlrunD9EEAy1u'  # Replace with a valid Subscription Key here.\n",
    "\n",
    "\n",
    "# 3、目标url\n",
    "# 这里也可以使用本地图片 例如：filepath =\"image/tupian.jpg\"\n",
    "BASE_URL = 'https://api-cn.faceplusplus.com/facepp/v3/detect' \n",
    "img_url = 'https://dss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=2604565815,280322145&fm=26&gp=0.jpg'\n",
    "\n",
    "# 4、沿用API文档的示范代码,准备我们的headers和图片(数据)\n",
    "\n",
    "headers = {\n",
    "    'Content-Type': 'application/json',\n",
    "}\n",
    "\n",
    "# 5、准备symbol ? 后面的数据\n",
    "\n",
    "payload = {\n",
    "    \"image_url\":img_url,\n",
    "    'api_key': api_key,\n",
    "    'api_secret': api_secret,\n",
    "    'return_attributes':'gender,age,smiling,emotion', \n",
    "}\n",
    "\n",
    "#  6、requests发送我们请求\n",
    "\n",
    "\n",
    "r = requests.post(BASE_URL, data=json.dumps(data), params=payload, headers=HEADERS)\n",
    "\n",
    "r.status_code\n",
    "result = r.json()\n",
    "result"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 170,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>attributes.age.value</th>\n",
       "      <th>attributes.emotion.anger</th>\n",
       "      <th>attributes.emotion.disgust</th>\n",
       "      <th>attributes.emotion.fear</th>\n",
       "      <th>attributes.emotion.happiness</th>\n",
       "      <th>attributes.emotion.neutral</th>\n",
       "      <th>attributes.emotion.sadness</th>\n",
       "      <th>attributes.emotion.surprise</th>\n",
       "      <th>attributes.gender.value</th>\n",
       "      <th>attributes.smile.threshold</th>\n",
       "      <th>attributes.smile.value</th>\n",
       "      <th>face_rectangle.height</th>\n",
       "      <th>face_rectangle.left</th>\n",
       "      <th>face_rectangle.top</th>\n",
       "      <th>face_rectangle.width</th>\n",
       "      <th>face_token</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>23</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.001</td>\n",
       "      <td>0.002</td>\n",
       "      <td>99.958</td>\n",
       "      <td>0.039</td>\n",
       "      <td>0.001</td>\n",
       "      <td>Male</td>\n",
       "      <td>50.0</td>\n",
       "      <td>0.044</td>\n",
       "      <td>41</td>\n",
       "      <td>349</td>\n",
       "      <td>117</td>\n",
       "      <td>41</td>\n",
       "      <td>542b532288622c7207a28035ef19012a</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>33</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.000</td>\n",
       "      <td>99.977</td>\n",
       "      <td>0.019</td>\n",
       "      <td>0.004</td>\n",
       "      <td>Male</td>\n",
       "      <td>50.0</td>\n",
       "      <td>0.719</td>\n",
       "      <td>40</td>\n",
       "      <td>102</td>\n",
       "      <td>119</td>\n",
       "      <td>40</td>\n",
       "      <td>15060c50094f7afb5a395677836961ae</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>24</td>\n",
       "      <td>0.076</td>\n",
       "      <td>0.007</td>\n",
       "      <td>0.005</td>\n",
       "      <td>0.060</td>\n",
       "      <td>99.213</td>\n",
       "      <td>0.032</td>\n",
       "      <td>0.608</td>\n",
       "      <td>Male</td>\n",
       "      <td>50.0</td>\n",
       "      <td>5.784</td>\n",
       "      <td>40</td>\n",
       "      <td>204</td>\n",
       "      <td>124</td>\n",
       "      <td>40</td>\n",
       "      <td>04c2897ee2754ae564f4fd9053e4252f</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   attributes.age.value  attributes.emotion.anger  attributes.emotion.disgust  \\\n",
       "0                    23                     0.000                       0.000   \n",
       "1                    33                     0.000                       0.000   \n",
       "2                    24                     0.076                       0.007   \n",
       "\n",
       "   attributes.emotion.fear  attributes.emotion.happiness  \\\n",
       "0                    0.001                         0.002   \n",
       "1                    0.000                         0.000   \n",
       "2                    0.005                         0.060   \n",
       "\n",
       "   attributes.emotion.neutral  attributes.emotion.sadness  \\\n",
       "0                      99.958                       0.039   \n",
       "1                      99.977                       0.019   \n",
       "2                      99.213                       0.032   \n",
       "\n",
       "   attributes.emotion.surprise attributes.gender.value  \\\n",
       "0                        0.001                    Male   \n",
       "1                        0.004                    Male   \n",
       "2                        0.608                    Male   \n",
       "\n",
       "   attributes.smile.threshold  attributes.smile.value  face_rectangle.height  \\\n",
       "0                        50.0                   0.044                     41   \n",
       "1                        50.0                   0.719                     40   \n",
       "2                        50.0                   5.784                     40   \n",
       "\n",
       "   face_rectangle.left  face_rectangle.top  face_rectangle.width  \\\n",
       "0                  349                 117                    41   \n",
       "1                  102                 119                    40   \n",
       "2                  204                 124                    40   \n",
       "\n",
       "                         face_token  \n",
       "0  542b532288622c7207a28035ef19012a  \n",
       "1  15060c50094f7afb5a395677836961ae  \n",
       "2  04c2897ee2754ae564f4fd9053e4252f  "
      ]
     },
     "execution_count": 170,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pandas as pd\n",
    "from pandas.io.json import json_normalize\n",
    "data = [{'face_token': '542b532288622c7207a28035ef19012a',\n",
    "   'face_rectangle': {'top': 117, 'left': 349, 'width': 41, 'height': 41},\n",
    "   'attributes': {'gender': {'value': 'Male'},\n",
    "    'age': {'value': 23},\n",
    "    'smile': {'value': 0.044, 'threshold': 50.0},\n",
    "    'emotion': {'anger': 0.0,\n",
    "     'disgust': 0.0,\n",
    "     'fear': 0.001,\n",
    "     'happiness': 0.002,\n",
    "     'neutral': 99.958,\n",
    "     'sadness': 0.039,\n",
    "     'surprise': 0.001}}},\n",
    "  {'face_token': '15060c50094f7afb5a395677836961ae',\n",
    "   'face_rectangle': {'top': 119, 'left': 102, 'width': 40, 'height': 40},\n",
    "   'attributes': {'gender': {'value': 'Male'},\n",
    "    'age': {'value': 33},\n",
    "    'smile': {'value': 0.719, 'threshold': 50.0},\n",
    "    'emotion': {'anger': 0.0,\n",
    "     'disgust': 0.0,\n",
    "     'fear': 0.0,\n",
    "     'happiness': 0.0,\n",
    "     'neutral': 99.977,\n",
    "     'sadness': 0.019,\n",
    "     'surprise': 0.004}}},\n",
    "  {'face_token': '04c2897ee2754ae564f4fd9053e4252f',\n",
    "   'face_rectangle': {'top': 124, 'left': 204, 'width': 40, 'height': 40},\n",
    "   'attributes': {'gender': {'value': 'Male'},\n",
    "    'age': {'value': 24},\n",
    "    'smile': {'value': 5.784, 'threshold': 50.0},\n",
    "    'emotion': {'anger': 0.076,\n",
    "     'disgust': 0.007,\n",
    "     'fear': 0.005,\n",
    "     'happiness': 0.06,\n",
    "     'neutral': 99.213,\n",
    "     'sadness': 0.032,\n",
    "     'surprise': 0.608}}}]\n",
    "json_normalize(data)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 173,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>attributes.age.value</th>\n",
       "      <th>attributes.emotion.anger</th>\n",
       "      <th>attributes.emotion.disgust</th>\n",
       "      <th>attributes.emotion.fear</th>\n",
       "      <th>attributes.emotion.happiness</th>\n",
       "      <th>attributes.emotion.neutral</th>\n",
       "      <th>attributes.emotion.sadness</th>\n",
       "      <th>attributes.emotion.surprise</th>\n",
       "      <th>attributes.gender.value</th>\n",
       "      <th>attributes.smile.threshold</th>\n",
       "      <th>attributes.smile.value</th>\n",
       "      <th>face_rectangle.height</th>\n",
       "      <th>face_rectangle.left</th>\n",
       "      <th>face_rectangle.top</th>\n",
       "      <th>face_rectangle.width</th>\n",
       "      <th>face_token</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>23</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.001</td>\n",
       "      <td>0.002</td>\n",
       "      <td>99.958</td>\n",
       "      <td>0.039</td>\n",
       "      <td>0.001</td>\n",
       "      <td>Male</td>\n",
       "      <td>50.0</td>\n",
       "      <td>0.044</td>\n",
       "      <td>41</td>\n",
       "      <td>349</td>\n",
       "      <td>117</td>\n",
       "      <td>41</td>\n",
       "      <td>542b532288622c7207a28035ef19012a</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>33</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.000</td>\n",
       "      <td>99.977</td>\n",
       "      <td>0.019</td>\n",
       "      <td>0.004</td>\n",
       "      <td>Male</td>\n",
       "      <td>50.0</td>\n",
       "      <td>0.719</td>\n",
       "      <td>40</td>\n",
       "      <td>102</td>\n",
       "      <td>119</td>\n",
       "      <td>40</td>\n",
       "      <td>15060c50094f7afb5a395677836961ae</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>24</td>\n",
       "      <td>0.076</td>\n",
       "      <td>0.007</td>\n",
       "      <td>0.005</td>\n",
       "      <td>0.060</td>\n",
       "      <td>99.213</td>\n",
       "      <td>0.032</td>\n",
       "      <td>0.608</td>\n",
       "      <td>Male</td>\n",
       "      <td>50.0</td>\n",
       "      <td>5.784</td>\n",
       "      <td>40</td>\n",
       "      <td>204</td>\n",
       "      <td>124</td>\n",
       "      <td>40</td>\n",
       "      <td>04c2897ee2754ae564f4fd9053e4252f</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   attributes.age.value  attributes.emotion.anger  attributes.emotion.disgust  \\\n",
       "0                    23                     0.000                       0.000   \n",
       "1                    33                     0.000                       0.000   \n",
       "2                    24                     0.076                       0.007   \n",
       "\n",
       "   attributes.emotion.fear  attributes.emotion.happiness  \\\n",
       "0                    0.001                         0.002   \n",
       "1                    0.000                         0.000   \n",
       "2                    0.005                         0.060   \n",
       "\n",
       "   attributes.emotion.neutral  attributes.emotion.sadness  \\\n",
       "0                      99.958                       0.039   \n",
       "1                      99.977                       0.019   \n",
       "2                      99.213                       0.032   \n",
       "\n",
       "   attributes.emotion.surprise attributes.gender.value  \\\n",
       "0                        0.001                    Male   \n",
       "1                        0.004                    Male   \n",
       "2                        0.608                    Male   \n",
       "\n",
       "   attributes.smile.threshold  attributes.smile.value  face_rectangle.height  \\\n",
       "0                        50.0                   0.044                     41   \n",
       "1                        50.0                   0.719                     40   \n",
       "2                        50.0                   5.784                     40   \n",
       "\n",
       "   face_rectangle.left  face_rectangle.top  face_rectangle.width  \\\n",
       "0                  349                 117                    41   \n",
       "1                  102                 119                    40   \n",
       "2                  204                 124                    40   \n",
       "\n",
       "                         face_token  \n",
       "0  542b532288622c7207a28035ef19012a  \n",
       "1  15060c50094f7afb5a395677836961ae  \n",
       "2  04c2897ee2754ae564f4fd9053e4252f  "
      ]
     },
     "execution_count": 173,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "result = json_normalize(data)\n",
    "result"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 174,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>attributes.age.value</th>\n",
       "      <th>生气</th>\n",
       "      <th>厌恶</th>\n",
       "      <th>害怕</th>\n",
       "      <th>高兴</th>\n",
       "      <th>平静</th>\n",
       "      <th>伤心</th>\n",
       "      <th>惊讶</th>\n",
       "      <th>性别</th>\n",
       "      <th>attributes.smile.threshold</th>\n",
       "      <th>微笑值</th>\n",
       "      <th>face_rectangle.height</th>\n",
       "      <th>face_rectangle.left</th>\n",
       "      <th>face_rectangle.top</th>\n",
       "      <th>face_rectangle.width</th>\n",
       "      <th>face_token</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>23</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.001</td>\n",
       "      <td>0.002</td>\n",
       "      <td>99.958</td>\n",
       "      <td>0.039</td>\n",
       "      <td>0.001</td>\n",
       "      <td>Male</td>\n",
       "      <td>50.0</td>\n",
       "      <td>0.044</td>\n",
       "      <td>41</td>\n",
       "      <td>349</td>\n",
       "      <td>117</td>\n",
       "      <td>41</td>\n",
       "      <td>542b532288622c7207a28035ef19012a</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>33</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.000</td>\n",
       "      <td>99.977</td>\n",
       "      <td>0.019</td>\n",
       "      <td>0.004</td>\n",
       "      <td>Male</td>\n",
       "      <td>50.0</td>\n",
       "      <td>0.719</td>\n",
       "      <td>40</td>\n",
       "      <td>102</td>\n",
       "      <td>119</td>\n",
       "      <td>40</td>\n",
       "      <td>15060c50094f7afb5a395677836961ae</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>24</td>\n",
       "      <td>0.076</td>\n",
       "      <td>0.007</td>\n",
       "      <td>0.005</td>\n",
       "      <td>0.060</td>\n",
       "      <td>99.213</td>\n",
       "      <td>0.032</td>\n",
       "      <td>0.608</td>\n",
       "      <td>Male</td>\n",
       "      <td>50.0</td>\n",
       "      <td>5.784</td>\n",
       "      <td>40</td>\n",
       "      <td>204</td>\n",
       "      <td>124</td>\n",
       "      <td>40</td>\n",
       "      <td>04c2897ee2754ae564f4fd9053e4252f</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   attributes.age.value     生气     厌恶     害怕     高兴      平静     伤心     惊讶  \\\n",
       "0                    23  0.000  0.000  0.001  0.002  99.958  0.039  0.001   \n",
       "1                    33  0.000  0.000  0.000  0.000  99.977  0.019  0.004   \n",
       "2                    24  0.076  0.007  0.005  0.060  99.213  0.032  0.608   \n",
       "\n",
       "     性别  attributes.smile.threshold    微笑值  face_rectangle.height  \\\n",
       "0  Male                        50.0  0.044                     41   \n",
       "1  Male                        50.0  0.719                     40   \n",
       "2  Male                        50.0  5.784                     40   \n",
       "\n",
       "   face_rectangle.left  face_rectangle.top  face_rectangle.width  \\\n",
       "0                  349                 117                    41   \n",
       "1                  102                 119                    40   \n",
       "2                  204                 124                    40   \n",
       "\n",
       "                         face_token  \n",
       "0  542b532288622c7207a28035ef19012a  \n",
       "1  15060c50094f7afb5a395677836961ae  \n",
       "2  04c2897ee2754ae564f4fd9053e4252f  "
      ]
     },
     "execution_count": 174,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = result.rename(columns={\"attributes.gender.value\":\"性别\",\n",
    "                             \"attributes.age\":\"年龄\",\n",
    "                             \"attributes.smile.value\":\"微笑值\",\n",
    "                             \"attributes.emotion.anger\":\"生气\",\n",
    "                             \"attributes.emotion.contempt\":\"蔑视\",\n",
    "                             \"attributes.emotion.disgust\":\"厌恶\",\n",
    "                             \"attributes.emotion.fear\":\"害怕\",\n",
    "                             \"attributes.emotion.happiness\":\"高兴\",\n",
    "                             \"attributes.emotion.neutral\":\"平静\",\n",
    "                             \"attributes.emotion.sadness\":\"伤心\",\n",
    "                             \"attributes.emotion.surprise\":\"惊讶\",})\n",
    "df"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##### 第二张照片（何以）\n",
    "![何以](https://dss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=624994472,4067490550&fm=26&gp=0.jpg)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 226,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'request_id': '1586761119,52dc07c2-8281-4fb2-9387-6cdea7dc04d0',\n",
       " 'time_used': 131,\n",
       " 'faces': [{'face_token': '6b4fbe0c05b444c396621bf35b0427eb',\n",
       "   'face_rectangle': {'top': 45, 'left': 120, 'width': 47, 'height': 47},\n",
       "   'attributes': {'gender': {'value': 'Male'},\n",
       "    'age': {'value': 25},\n",
       "    'smile': {'value': 0.013, 'threshold': 50.0},\n",
       "    'emotion': {'anger': 1.32,\n",
       "     'disgust': 0.006,\n",
       "     'fear': 0.006,\n",
       "     'happiness': 0.006,\n",
       "     'neutral': 98.495,\n",
       "     'sadness': 0.007,\n",
       "     'surprise': 0.161}}}],\n",
       " 'image_id': '8ycSswPJC0e844mHuQMXPg==',\n",
       " 'face_num': 1}"
      ]
     },
     "execution_count": 226,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 1、先导入为们需要的模块\n",
    "import requests\n",
    "import json\n",
    "\n",
    "api_secret = \"Mg-S0entZbf1iVCBFAgM__d2TOeakTNZ\"\n",
    "# 2、输入我们API_Key\n",
    "api_key = 'aenENjllcy4-fqzCka_HlrunD9EEAy1u'  # Replace with a valid Subscription Key here.\n",
    "\n",
    "\n",
    "# 3、目标url\n",
    "# 这里也可以使用本地图片 例如：filepath =\"image/tupian.jpg\"\n",
    "BASE_URL = 'https://api-cn.faceplusplus.com/facepp/v3/detect' \n",
    "img_url = 'https://dss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=624994472,4067490550&fm=26&gp=0.jpg'\n",
    "\n",
    "# 4、沿用API文档的示范代码,准备我们的headers和图片(数据)\n",
    "\n",
    "headers = {\n",
    "    'Content-Type': 'application/json',\n",
    "}\n",
    "\n",
    "# 5、准备symbol ? 后面的数据\n",
    "\n",
    "payload = {\n",
    "    \"image_url\":img_url,\n",
    "    'api_key': api_key,\n",
    "    'api_secret': api_secret,\n",
    "    'return_attributes':'gender,age,smiling,emotion', \n",
    "}\n",
    "\n",
    "#  6、requests发送我们请求\n",
    "\n",
    "\n",
    "r = requests.post(BASE_URL, data=json.dumps(data), params=payload, headers=HEADERS)\n",
    "\n",
    "r.status_code\n",
    "result = r.json()\n",
    "result"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 227,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>attributes.age.value</th>\n",
       "      <th>attributes.emotion.anger</th>\n",
       "      <th>attributes.emotion.disgust</th>\n",
       "      <th>attributes.emotion.fear</th>\n",
       "      <th>attributes.emotion.happiness</th>\n",
       "      <th>attributes.emotion.neutral</th>\n",
       "      <th>attributes.emotion.sadness</th>\n",
       "      <th>attributes.emotion.surprise</th>\n",
       "      <th>attributes.gender.value</th>\n",
       "      <th>attributes.smile.threshold</th>\n",
       "      <th>attributes.smile.value</th>\n",
       "      <th>face_rectangle.height</th>\n",
       "      <th>face_rectangle.left</th>\n",
       "      <th>face_rectangle.top</th>\n",
       "      <th>face_rectangle.width</th>\n",
       "      <th>face_token</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>25</td>\n",
       "      <td>1.32</td>\n",
       "      <td>0.006</td>\n",
       "      <td>0.006</td>\n",
       "      <td>0.006</td>\n",
       "      <td>98.495</td>\n",
       "      <td>0.007</td>\n",
       "      <td>0.161</td>\n",
       "      <td>Male</td>\n",
       "      <td>50.0</td>\n",
       "      <td>0.013</td>\n",
       "      <td>47</td>\n",
       "      <td>120</td>\n",
       "      <td>45</td>\n",
       "      <td>47</td>\n",
       "      <td>b694548d5d1b14986832078733797748</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   attributes.age.value  attributes.emotion.anger  attributes.emotion.disgust  \\\n",
       "0                    25                      1.32                       0.006   \n",
       "\n",
       "   attributes.emotion.fear  attributes.emotion.happiness  \\\n",
       "0                    0.006                         0.006   \n",
       "\n",
       "   attributes.emotion.neutral  attributes.emotion.sadness  \\\n",
       "0                      98.495                       0.007   \n",
       "\n",
       "   attributes.emotion.surprise attributes.gender.value  \\\n",
       "0                        0.161                    Male   \n",
       "\n",
       "   attributes.smile.threshold  attributes.smile.value  face_rectangle.height  \\\n",
       "0                        50.0                   0.013                     47   \n",
       "\n",
       "   face_rectangle.left  face_rectangle.top  face_rectangle.width  \\\n",
       "0                  120                  45                    47   \n",
       "\n",
       "                         face_token  \n",
       "0  b694548d5d1b14986832078733797748  "
      ]
     },
     "execution_count": 227,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pandas as pd\n",
    "from pandas.io.json import json_normalize\n",
    "data = [{'face_token': 'b694548d5d1b14986832078733797748',\n",
    "   'face_rectangle': {'top': 45, 'left': 120, 'width': 47, 'height': 47},\n",
    "   'attributes': {'gender': {'value': 'Male'},\n",
    "    'age': {'value': 25},\n",
    "    'smile': {'value': 0.013, 'threshold': 50.0},\n",
    "    'emotion': {'anger': 1.32,\n",
    "     'disgust': 0.006,\n",
    "     'fear': 0.006,\n",
    "     'happiness': 0.006,\n",
    "     'neutral': 98.495,\n",
    "     'sadness': 0.007,\n",
    "     'surprise': 0.161}}}]\n",
    "json_normalize(data)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 229,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>attributes.age.value</th>\n",
       "      <th>attributes.emotion.anger</th>\n",
       "      <th>attributes.emotion.disgust</th>\n",
       "      <th>attributes.emotion.fear</th>\n",
       "      <th>attributes.emotion.happiness</th>\n",
       "      <th>attributes.emotion.neutral</th>\n",
       "      <th>attributes.emotion.sadness</th>\n",
       "      <th>attributes.emotion.surprise</th>\n",
       "      <th>attributes.gender.value</th>\n",
       "      <th>attributes.smile.threshold</th>\n",
       "      <th>attributes.smile.value</th>\n",
       "      <th>face_rectangle.height</th>\n",
       "      <th>face_rectangle.left</th>\n",
       "      <th>face_rectangle.top</th>\n",
       "      <th>face_rectangle.width</th>\n",
       "      <th>face_token</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>25</td>\n",
       "      <td>1.32</td>\n",
       "      <td>0.006</td>\n",
       "      <td>0.006</td>\n",
       "      <td>0.006</td>\n",
       "      <td>98.495</td>\n",
       "      <td>0.007</td>\n",
       "      <td>0.161</td>\n",
       "      <td>Male</td>\n",
       "      <td>50.0</td>\n",
       "      <td>0.013</td>\n",
       "      <td>47</td>\n",
       "      <td>120</td>\n",
       "      <td>45</td>\n",
       "      <td>47</td>\n",
       "      <td>b694548d5d1b14986832078733797748</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   attributes.age.value  attributes.emotion.anger  attributes.emotion.disgust  \\\n",
       "0                    25                      1.32                       0.006   \n",
       "\n",
       "   attributes.emotion.fear  attributes.emotion.happiness  \\\n",
       "0                    0.006                         0.006   \n",
       "\n",
       "   attributes.emotion.neutral  attributes.emotion.sadness  \\\n",
       "0                      98.495                       0.007   \n",
       "\n",
       "   attributes.emotion.surprise attributes.gender.value  \\\n",
       "0                        0.161                    Male   \n",
       "\n",
       "   attributes.smile.threshold  attributes.smile.value  face_rectangle.height  \\\n",
       "0                        50.0                   0.013                     47   \n",
       "\n",
       "   face_rectangle.left  face_rectangle.top  face_rectangle.width  \\\n",
       "0                  120                  45                    47   \n",
       "\n",
       "                         face_token  \n",
       "0  b694548d5d1b14986832078733797748  "
      ]
     },
     "execution_count": 229,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "result = json_normalize(data)\n",
    "result"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 230,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>年龄</th>\n",
       "      <th>生气</th>\n",
       "      <th>厌恶</th>\n",
       "      <th>害怕</th>\n",
       "      <th>高兴</th>\n",
       "      <th>平静</th>\n",
       "      <th>伤心</th>\n",
       "      <th>惊讶</th>\n",
       "      <th>性别</th>\n",
       "      <th>attributes.smile.threshold</th>\n",
       "      <th>微笑值</th>\n",
       "      <th>face_rectangle.height</th>\n",
       "      <th>face_rectangle.left</th>\n",
       "      <th>face_rectangle.top</th>\n",
       "      <th>face_rectangle.width</th>\n",
       "      <th>face_token</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>25</td>\n",
       "      <td>1.32</td>\n",
       "      <td>0.006</td>\n",
       "      <td>0.006</td>\n",
       "      <td>0.006</td>\n",
       "      <td>98.495</td>\n",
       "      <td>0.007</td>\n",
       "      <td>0.161</td>\n",
       "      <td>Male</td>\n",
       "      <td>50.0</td>\n",
       "      <td>0.013</td>\n",
       "      <td>47</td>\n",
       "      <td>120</td>\n",
       "      <td>45</td>\n",
       "      <td>47</td>\n",
       "      <td>b694548d5d1b14986832078733797748</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   年龄    生气     厌恶     害怕     高兴      平静     伤心     惊讶    性别  \\\n",
       "0  25  1.32  0.006  0.006  0.006  98.495  0.007  0.161  Male   \n",
       "\n",
       "   attributes.smile.threshold    微笑值  face_rectangle.height  \\\n",
       "0                        50.0  0.013                     47   \n",
       "\n",
       "   face_rectangle.left  face_rectangle.top  face_rectangle.width  \\\n",
       "0                  120                  45                    47   \n",
       "\n",
       "                         face_token  \n",
       "0  b694548d5d1b14986832078733797748  "
      ]
     },
     "execution_count": 230,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "face_data = result.rename(columns={\"attributes.gender.value\":\"性别\",\n",
    "                             \"attributes.age.value\":\"年龄\",\n",
    "                             \"attributes.smile.value\":\"微笑值\",\n",
    "                             \"attributes.emotion.anger\":\"生气\",\n",
    "                             \"attributes.emotion.contempt\":\"蔑视\",\n",
    "                             \"attributes.emotion.disgust\":\"厌恶\",\n",
    "                             \"attributes.emotion.fear\":\"害怕\",\n",
    "                             \"attributes.emotion.happiness\":\"高兴\",\n",
    "                             \"attributes.emotion.neutral\":\"平静\",\n",
    "                             \"attributes.emotion.sadness\":\"伤心\",\n",
    "                             \"attributes.emotion.surprise\":\"惊讶\",})\n",
    "face_data"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##### 第三张图片（金陵十三钗）\n",
    "![金陵十三钗](https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1586771619441&di=98798a865ceca830e36ea4b079404d32&imgtype=0&src=http%3A%2F%2Fimg4.imgtn.bdimg.com%2Fit%2Fu%3D3251791109%2C823183404%26fm%3D214%26gp%3D0.jpg)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##### face++人脸识别总结\n",
    "* face++ 的账号申请比较简单，注册后创建一个应用就可以生成可用的api_key和api_secret.\n",
    "* face++ 的人脸识别可以一张图多张脸，但是对人脸的要求比较高，歪头闭眼识别不出来，参考第二张图片（何以）\n",
    "* face++ 作为国内的人脸识别系统，好像对外国男人有点偏见（可能是因为长胡子吧），外国男士的预测年龄普遍较老，这可能是face++需要改进的地方，参考第三张图片（金陵十三钗）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 235,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'request_id': '1586761923,7a257452-1045-42fd-9657-c870093a951b',\n",
       " 'time_used': 306,\n",
       " 'faces': [{'face_token': 'fe6a3b6c775d3b0b38947c220e285037',\n",
       "   'face_rectangle': {'top': 66, 'left': 376, 'width': 68, 'height': 68},\n",
       "   'attributes': {'gender': {'value': 'Female'},\n",
       "    'age': {'value': 23},\n",
       "    'smile': {'value': 99.999, 'threshold': 50.0},\n",
       "    'emotion': {'anger': 0.0,\n",
       "     'disgust': 0.0,\n",
       "     'fear': 0.0,\n",
       "     'happiness': 99.998,\n",
       "     'neutral': 0.0,\n",
       "     'sadness': 0.002,\n",
       "     'surprise': 0.0}}},\n",
       "  {'face_token': '5d8121488e65952538c6a55828165e14',\n",
       "   'face_rectangle': {'top': 81, 'left': 259, 'width': 59, 'height': 59},\n",
       "   'attributes': {'gender': {'value': 'Male'},\n",
       "    'age': {'value': 63},\n",
       "    'smile': {'value': 76.057, 'threshold': 50.0},\n",
       "    'emotion': {'anger': 0.4,\n",
       "     'disgust': 0.017,\n",
       "     'fear': 0.017,\n",
       "     'happiness': 1.435,\n",
       "     'neutral': 97.868,\n",
       "     'sadness': 0.246,\n",
       "     'surprise': 0.017}}},\n",
       "  {'face_token': 'dbcf46288e49d12f9c15d4c171703fb0',\n",
       "   'face_rectangle': {'top': 115, 'left': 196, 'width': 38, 'height': 38},\n",
       "   'attributes': {'gender': {'value': 'Male'},\n",
       "    'age': {'value': 51},\n",
       "    'smile': {'value': 0.466, 'threshold': 50.0},\n",
       "    'emotion': {'anger': 0.0,\n",
       "     'disgust': 0.0,\n",
       "     'fear': 0.0,\n",
       "     'happiness': 0.001,\n",
       "     'neutral': 99.998,\n",
       "     'sadness': 0.0,\n",
       "     'surprise': 0.001}}},\n",
       "  {'face_token': 'a30660ec5cf4220d945109bd4a8fa29c',\n",
       "   'face_rectangle': {'top': 69, 'left': 88, 'width': 36, 'height': 36},\n",
       "   'attributes': {'gender': {'value': 'Female'},\n",
       "    'age': {'value': 23},\n",
       "    'smile': {'value': 1.584, 'threshold': 50.0},\n",
       "    'emotion': {'anger': 0.878,\n",
       "     'disgust': 0.271,\n",
       "     'fear': 1.721,\n",
       "     'happiness': 45.667,\n",
       "     'neutral': 27.45,\n",
       "     'sadness': 0.271,\n",
       "     'surprise': 23.742}}}],\n",
       " 'image_id': '8dGzQEbekMGvw6EpQd1DYQ==',\n",
       " 'face_num': 4}"
      ]
     },
     "execution_count": 235,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 1、先导入为们需要的模块\n",
    "import requests\n",
    "import json\n",
    "\n",
    "api_secret = \"Mg-S0entZbf1iVCBFAgM__d2TOeakTNZ\"\n",
    "# 2、输入我们API_Key\n",
    "api_key = 'aenENjllcy4-fqzCka_HlrunD9EEAy1u'  # Replace with a valid Subscription Key here.\n",
    "\n",
    "\n",
    "# 3、目标url\n",
    "# 这里也可以使用本地图片 例如：filepath =\"image/tupian.jpg\"\n",
    "BASE_URL = 'https://api-cn.faceplusplus.com/facepp/v3/detect' \n",
    "img_url = 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1586771619441&di=98798a865ceca830e36ea4b079404d32&imgtype=0&src=http%3A%2F%2Fimg4.imgtn.bdimg.com%2Fit%2Fu%3D3251791109%2C823183404%26fm%3D214%26gp%3D0.jpg'\n",
    "\n",
    "# 4、沿用API文档的示范代码,准备我们的headers和图片(数据)\n",
    "\n",
    "headers = {\n",
    "    'Content-Type': 'application/json',\n",
    "}\n",
    "\n",
    "# 5、准备symbol ? 后面的数据\n",
    "\n",
    "payload = {\n",
    "    \"image_url\":img_url,\n",
    "    'api_key': api_key,\n",
    "    'api_secret': api_secret,\n",
    "    'return_attributes':'gender,age,smiling,emotion', \n",
    "}\n",
    "\n",
    "#  6、requests发送我们请求\n",
    "\n",
    "\n",
    "r = requests.post(BASE_URL, data=json.dumps(data), params=payload, headers=HEADERS)\n",
    "\n",
    "r.status_code\n",
    "result = r.json()\n",
    "result"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 237,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>attributes.age.value</th>\n",
       "      <th>attributes.emotion.anger</th>\n",
       "      <th>attributes.emotion.disgust</th>\n",
       "      <th>attributes.emotion.fear</th>\n",
       "      <th>attributes.emotion.happiness</th>\n",
       "      <th>attributes.emotion.neutral</th>\n",
       "      <th>attributes.emotion.sadness</th>\n",
       "      <th>attributes.emotion.surprise</th>\n",
       "      <th>attributes.gender.value</th>\n",
       "      <th>attributes.smile.threshold</th>\n",
       "      <th>attributes.smile.value</th>\n",
       "      <th>face_rectangle.height</th>\n",
       "      <th>face_rectangle.left</th>\n",
       "      <th>face_rectangle.top</th>\n",
       "      <th>face_rectangle.width</th>\n",
       "      <th>face_token</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>23</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.000</td>\n",
       "      <td>99.998</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.002</td>\n",
       "      <td>0.000</td>\n",
       "      <td>Female</td>\n",
       "      <td>50.0</td>\n",
       "      <td>99.999</td>\n",
       "      <td>68</td>\n",
       "      <td>376</td>\n",
       "      <td>66</td>\n",
       "      <td>68</td>\n",
       "      <td>fe6a3b6c775d3b0b38947c220e285037</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>63</td>\n",
       "      <td>0.400</td>\n",
       "      <td>0.017</td>\n",
       "      <td>0.017</td>\n",
       "      <td>1.435</td>\n",
       "      <td>97.868</td>\n",
       "      <td>0.246</td>\n",
       "      <td>0.017</td>\n",
       "      <td>Male</td>\n",
       "      <td>50.0</td>\n",
       "      <td>76.057</td>\n",
       "      <td>59</td>\n",
       "      <td>259</td>\n",
       "      <td>81</td>\n",
       "      <td>59</td>\n",
       "      <td>5d8121488e65952538c6a55828165e14</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>51</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.001</td>\n",
       "      <td>99.998</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.001</td>\n",
       "      <td>Male</td>\n",
       "      <td>50.0</td>\n",
       "      <td>0.466</td>\n",
       "      <td>38</td>\n",
       "      <td>196</td>\n",
       "      <td>115</td>\n",
       "      <td>38</td>\n",
       "      <td>dbcf46288e49d12f9c15d4c171703fb0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>23</td>\n",
       "      <td>0.878</td>\n",
       "      <td>0.271</td>\n",
       "      <td>1.721</td>\n",
       "      <td>45.667</td>\n",
       "      <td>27.450</td>\n",
       "      <td>0.271</td>\n",
       "      <td>23.742</td>\n",
       "      <td>Female</td>\n",
       "      <td>50.0</td>\n",
       "      <td>1.584</td>\n",
       "      <td>36</td>\n",
       "      <td>88</td>\n",
       "      <td>69</td>\n",
       "      <td>36</td>\n",
       "      <td>a30660ec5cf4220d945109bd4a8fa29c</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   attributes.age.value  attributes.emotion.anger  attributes.emotion.disgust  \\\n",
       "0                    23                     0.000                       0.000   \n",
       "1                    63                     0.400                       0.017   \n",
       "2                    51                     0.000                       0.000   \n",
       "3                    23                     0.878                       0.271   \n",
       "\n",
       "   attributes.emotion.fear  attributes.emotion.happiness  \\\n",
       "0                    0.000                        99.998   \n",
       "1                    0.017                         1.435   \n",
       "2                    0.000                         0.001   \n",
       "3                    1.721                        45.667   \n",
       "\n",
       "   attributes.emotion.neutral  attributes.emotion.sadness  \\\n",
       "0                       0.000                       0.002   \n",
       "1                      97.868                       0.246   \n",
       "2                      99.998                       0.000   \n",
       "3                      27.450                       0.271   \n",
       "\n",
       "   attributes.emotion.surprise attributes.gender.value  \\\n",
       "0                        0.000                  Female   \n",
       "1                        0.017                    Male   \n",
       "2                        0.001                    Male   \n",
       "3                       23.742                  Female   \n",
       "\n",
       "   attributes.smile.threshold  attributes.smile.value  face_rectangle.height  \\\n",
       "0                        50.0                  99.999                     68   \n",
       "1                        50.0                  76.057                     59   \n",
       "2                        50.0                   0.466                     38   \n",
       "3                        50.0                   1.584                     36   \n",
       "\n",
       "   face_rectangle.left  face_rectangle.top  face_rectangle.width  \\\n",
       "0                  376                  66                    68   \n",
       "1                  259                  81                    59   \n",
       "2                  196                 115                    38   \n",
       "3                   88                  69                    36   \n",
       "\n",
       "                         face_token  \n",
       "0  fe6a3b6c775d3b0b38947c220e285037  \n",
       "1  5d8121488e65952538c6a55828165e14  \n",
       "2  dbcf46288e49d12f9c15d4c171703fb0  \n",
       "3  a30660ec5cf4220d945109bd4a8fa29c  "
      ]
     },
     "execution_count": 237,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pandas as pd\n",
    "from pandas.io.json import json_normalize\n",
    "data = [{'face_token': 'fe6a3b6c775d3b0b38947c220e285037',\n",
    "   'face_rectangle': {'top': 66, 'left': 376, 'width': 68, 'height': 68},\n",
    "   'attributes': {'gender': {'value': 'Female'},\n",
    "    'age': {'value': 23},\n",
    "    'smile': {'value': 99.999, 'threshold': 50.0},\n",
    "    'emotion': {'anger': 0.0,\n",
    "     'disgust': 0.0,\n",
    "     'fear': 0.0,\n",
    "     'happiness': 99.998,\n",
    "     'neutral': 0.0,\n",
    "     'sadness': 0.002,\n",
    "     'surprise': 0.0}}},\n",
    "  {'face_token': '5d8121488e65952538c6a55828165e14',\n",
    "   'face_rectangle': {'top': 81, 'left': 259, 'width': 59, 'height': 59},\n",
    "   'attributes': {'gender': {'value': 'Male'},\n",
    "    'age': {'value': 63},\n",
    "    'smile': {'value': 76.057, 'threshold': 50.0},\n",
    "    'emotion': {'anger': 0.4,\n",
    "     'disgust': 0.017,\n",
    "     'fear': 0.017,\n",
    "     'happiness': 1.435,\n",
    "     'neutral': 97.868,\n",
    "     'sadness': 0.246,\n",
    "     'surprise': 0.017}}},\n",
    "  {'face_token': 'dbcf46288e49d12f9c15d4c171703fb0',\n",
    "   'face_rectangle': {'top': 115, 'left': 196, 'width': 38, 'height': 38},\n",
    "   'attributes': {'gender': {'value': 'Male'},\n",
    "    'age': {'value': 51},\n",
    "    'smile': {'value': 0.466, 'threshold': 50.0},\n",
    "    'emotion': {'anger': 0.0,\n",
    "     'disgust': 0.0,\n",
    "     'fear': 0.0,\n",
    "     'happiness': 0.001,\n",
    "     'neutral': 99.998,\n",
    "     'sadness': 0.0,\n",
    "     'surprise': 0.001}}},\n",
    "  {'face_token': 'a30660ec5cf4220d945109bd4a8fa29c',\n",
    "   'face_rectangle': {'top': 69, 'left': 88, 'width': 36, 'height': 36},\n",
    "   'attributes': {'gender': {'value': 'Female'},\n",
    "    'age': {'value': 23},\n",
    "    'smile': {'value': 1.584, 'threshold': 50.0},\n",
    "    'emotion': {'anger': 0.878,\n",
    "     'disgust': 0.271,\n",
    "     'fear': 1.721,\n",
    "     'happiness': 45.667,\n",
    "     'neutral': 27.45,\n",
    "     'sadness': 0.271,\n",
    "     'surprise': 23.742}}}]\n",
    "json_normalize(data)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 238,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>年龄</th>\n",
       "      <th>生气</th>\n",
       "      <th>厌恶</th>\n",
       "      <th>害怕</th>\n",
       "      <th>高兴</th>\n",
       "      <th>平静</th>\n",
       "      <th>伤心</th>\n",
       "      <th>惊讶</th>\n",
       "      <th>性别</th>\n",
       "      <th>attributes.smile.threshold</th>\n",
       "      <th>微笑值</th>\n",
       "      <th>face_rectangle.height</th>\n",
       "      <th>face_rectangle.left</th>\n",
       "      <th>face_rectangle.top</th>\n",
       "      <th>face_rectangle.width</th>\n",
       "      <th>face_token</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>23</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.000</td>\n",
       "      <td>99.998</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.002</td>\n",
       "      <td>0.000</td>\n",
       "      <td>Female</td>\n",
       "      <td>50.0</td>\n",
       "      <td>99.999</td>\n",
       "      <td>68</td>\n",
       "      <td>376</td>\n",
       "      <td>66</td>\n",
       "      <td>68</td>\n",
       "      <td>fe6a3b6c775d3b0b38947c220e285037</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>63</td>\n",
       "      <td>0.400</td>\n",
       "      <td>0.017</td>\n",
       "      <td>0.017</td>\n",
       "      <td>1.435</td>\n",
       "      <td>97.868</td>\n",
       "      <td>0.246</td>\n",
       "      <td>0.017</td>\n",
       "      <td>Male</td>\n",
       "      <td>50.0</td>\n",
       "      <td>76.057</td>\n",
       "      <td>59</td>\n",
       "      <td>259</td>\n",
       "      <td>81</td>\n",
       "      <td>59</td>\n",
       "      <td>5d8121488e65952538c6a55828165e14</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>51</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.001</td>\n",
       "      <td>99.998</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.001</td>\n",
       "      <td>Male</td>\n",
       "      <td>50.0</td>\n",
       "      <td>0.466</td>\n",
       "      <td>38</td>\n",
       "      <td>196</td>\n",
       "      <td>115</td>\n",
       "      <td>38</td>\n",
       "      <td>dbcf46288e49d12f9c15d4c171703fb0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>23</td>\n",
       "      <td>0.878</td>\n",
       "      <td>0.271</td>\n",
       "      <td>1.721</td>\n",
       "      <td>45.667</td>\n",
       "      <td>27.450</td>\n",
       "      <td>0.271</td>\n",
       "      <td>23.742</td>\n",
       "      <td>Female</td>\n",
       "      <td>50.0</td>\n",
       "      <td>1.584</td>\n",
       "      <td>36</td>\n",
       "      <td>88</td>\n",
       "      <td>69</td>\n",
       "      <td>36</td>\n",
       "      <td>a30660ec5cf4220d945109bd4a8fa29c</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   年龄     生气     厌恶     害怕      高兴      平静     伤心      惊讶      性别  \\\n",
       "0  23  0.000  0.000  0.000  99.998   0.000  0.002   0.000  Female   \n",
       "1  63  0.400  0.017  0.017   1.435  97.868  0.246   0.017    Male   \n",
       "2  51  0.000  0.000  0.000   0.001  99.998  0.000   0.001    Male   \n",
       "3  23  0.878  0.271  1.721  45.667  27.450  0.271  23.742  Female   \n",
       "\n",
       "   attributes.smile.threshold     微笑值  face_rectangle.height  \\\n",
       "0                        50.0  99.999                     68   \n",
       "1                        50.0  76.057                     59   \n",
       "2                        50.0   0.466                     38   \n",
       "3                        50.0   1.584                     36   \n",
       "\n",
       "   face_rectangle.left  face_rectangle.top  face_rectangle.width  \\\n",
       "0                  376                  66                    68   \n",
       "1                  259                  81                    59   \n",
       "2                  196                 115                    38   \n",
       "3                   88                  69                    36   \n",
       "\n",
       "                         face_token  \n",
       "0  fe6a3b6c775d3b0b38947c220e285037  \n",
       "1  5d8121488e65952538c6a55828165e14  \n",
       "2  dbcf46288e49d12f9c15d4c171703fb0  \n",
       "3  a30660ec5cf4220d945109bd4a8fa29c  "
      ]
     },
     "execution_count": 238,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "face_data = json_normalize(data).rename(columns={\"attributes.gender.value\":\"性别\",\n",
    "                             \"attributes.age.value\":\"年龄\",\n",
    "                             \"attributes.smile.value\":\"微笑值\",\n",
    "                             \"attributes.emotion.anger\":\"生气\",\n",
    "                             \"attributes.emotion.contempt\":\"蔑视\",\n",
    "                             \"attributes.emotion.disgust\":\"厌恶\",\n",
    "                             \"attributes.emotion.fear\":\"害怕\",\n",
    "                             \"attributes.emotion.happiness\":\"高兴\",\n",
    "                             \"attributes.emotion.neutral\":\"平静\",\n",
    "                             \"attributes.emotion.sadness\":\"伤心\",\n",
    "                             \"attributes.emotion.surprise\":\"惊讶\",})\n",
    "face_data"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 运用百度大脑的API识别图片人脸数据"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##### 一张照片（钟汉良）\n",
    "![钟汉良](https://dss2.bdstatic.com/6Ot1bjeh1BF3odCf/it/u=1651203239,1813209061&fm=74&app=80&f=JPEG&size=f121,140?sec=1880279984&t=e9a5f28dcf66515ece6416d13f2e045e)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 257,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{'refresh_token': '25.92d817fc848e747cb1b06529fc34cbc3.315360000.1902123496.282335-19389808', 'expires_in': 2592000, 'session_key': '9mzdXqFeK95bh3aj8Lx1PYq3Lu31Gp2XPleYIxxJ+ZYUg6z2UJiGTrNH3k7Tg3K7lM0szim1PDonKFfqjUzdiwHTSUrbkw==', 'access_token': '24.ed57b251a1d26a7f6e959a6b3d447842.2592000.1589355496.282335-19389808', 'scope': 'public brain_all_scope vis-faceverify_faceverify_h5-face-liveness vis-faceverify_FACE_V3 vis-faceverify_idl_face_merge wise_adapt lebo_resource_base lightservice_public hetu_basic lightcms_map_poi kaidian_kaidian ApsMisTest_Test权限 vis-classify_flower lpq_开放 cop_helloScope ApsMis_fangdi_permission smartapp_snsapi_base iop_autocar oauth_tp_app smartapp_smart_game_openapi oauth_sessionkey smartapp_swanid_verify smartapp_opensource_openapi smartapp_opensource_recapi qatest_scope1 fake_face_detect_开放Scope vis-ocr_虚拟人物助理 idl-video_虚拟人物助理', 'session_secret': 'fa778d9a2257e69637faf102017de266'}\n"
     ]
    }
   ],
   "source": [
    "# encoding:utf-8\n",
    "import requests \n",
    "\n",
    "# client_id 为官网获取的AK， client_secret 为官网获取的SK\n",
    "host = 'https://aip.baidubce.com/oauth/2.0/token?grant_type=client_credentials&client_id=hhVooxMwQLAE6PlsdcEvnVzu&client_secret=KNtPMwh2K2kNOANXv2mIfHpAPAcxwXC7'\n",
    "response = requests.get(host)\n",
    "if response:\n",
    "    print(response.json())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 258,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "b'{\"error_code\":0,\"error_msg\":\"SUCCESS\",\"log_id\":8999451599759,\"timestamp\":1586763500,\"cached\":0,\"result\":{\"face_num\":1,\"face_list\":[{\"face_token\":\"027d8308a2ec665acb1bdf63e513bcb9\",\"location\":{\"left\":97.35,\"top\":83.68,\"width\":99,\"height\":89,\"rotation\":-13},\"face_probability\":1,\"angle\":{\"pitch\":-5.8,\"roll\":-14.62,\"yaw\":-16.19},\"face_shape\":{\"type\":\"round\",\"probability\":0.43},\"face_type\":{\"type\":\"human\",\"probability\":1},\"age\":31,\"gender\":{\"type\":\"male\",\"probability\":1}}]}}'\n"
     ]
    }
   ],
   "source": [
    "import requests\n",
    "\n",
    "request_url = \"https://aip.baidubce.com/rest/2.0/face/v3/detect\"\n",
    "\n",
    "\n",
    "image_BASE64 : \"base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQYGBcUFhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSj/2wBDAQcHBwoIChMKChMoGhYaKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCj/wAARCAD/AaQDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJ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4PuPb1p9k/mRgd/8adPH5pRT8rAFlbuDQKL7keoRu0Bcum1SDwOeamtpX+yYbaGjy+R+hqLc4mMbYKuvQDuKfIGi/eIwCqCHUjO4GoRu9tTy/xJNn4mSXXlt81qmR15z1rT8M+ZLqU9xxh2xtbrxWVrMjN41kdyuRbADaOwNaOgTrEqgkhixbIHvSvqRFN6I9h0JI5LRfNy7q2ArDAHuKszzOsyRxZLvzlewz/kVz+l6gWihWHkuf4uOB2plpbXNlqIFpPLFabzNcYIYoCeAM9uMcdK0vroCoXu2dPcQmRwzvufHO1to/Kiqdzqdu0uUZmXHBwaKq5z6n//2Q==\"\n",
    "#image_url:\"https://dss2.bdstatic.com/6Ot1bjeh1BF3odCf/it/u=1651203239,1813209061&fm=74&app=80&f=JPEG&size=f121,140?sec=1880279984&t=e9a5f28dcf66515ece6416d13f2e045e\"\n",
    "\n",
    "params = \"{\\\"image\\\":\\\"027d8308a2ec665acb1bdf63e513bcb9\\\",\\\"image_type\\\":\\\"FACE_TOKEN\\\",\n",
    "\\\"face_field\\\":\\\"faceshape,facetype,age,gender\\\"}\"\n",
    "  \n",
    "options = {\n",
    "        'face_fields': \"age,beauty,expression,faceshape,landmark\",\n",
    "    }\n",
    "\n",
    "access_token = '24.fa3a8591fb56e91beb6c5d469283f0d7.2592000.1589268770.282335-19389808'\n",
    "request_url = request_url + \"?access_token=\" + access_token\n",
    "headers = {'content-type': 'application/json'}\n",
    "response = requests.post(request_url, data=params, headers=headers)\n",
    "\n",
    "#r = requests.post(BASE_URL, params=payload, headers=headers)\n",
    "\n",
    "response.status_code\n",
    "print(response.content)\n",
    "#if response:\n",
    "#    print (response.json())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 259,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'error_code': 0,\n",
       " 'error_msg': 'SUCCESS',\n",
       " 'log_id': 8999451599759,\n",
       " 'timestamp': 1586763500,\n",
       " 'cached': 0,\n",
       " 'result': {'face_num': 1,\n",
       "  'face_list': [{'face_token': '027d8308a2ec665acb1bdf63e513bcb9',\n",
       "    'location': {'left': 97.35,\n",
       "     'top': 83.68,\n",
       "     'width': 99,\n",
       "     'height': 89,\n",
       "     'rotation': -13},\n",
       "    'face_probability': 1,\n",
       "    'angle': {'pitch': -5.8, 'roll': -14.62, 'yaw': -16.19},\n",
       "    'face_shape': {'type': 'round', 'probability': 0.43},\n",
       "    'face_type': {'type': 'human', 'probability': 1},\n",
       "    'age': 31,\n",
       "    'gender': {'type': 'male', 'probability': 1}}]}}"
      ]
     },
     "execution_count": 259,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "r = response.json()\n",
    "r"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 260,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>age</th>\n",
       "      <th>angle.pitch</th>\n",
       "      <th>angle.roll</th>\n",
       "      <th>angle.yaw</th>\n",
       "      <th>face_probability</th>\n",
       "      <th>face_shape.probability</th>\n",
       "      <th>face_shape.type</th>\n",
       "      <th>face_token</th>\n",
       "      <th>face_type.probability</th>\n",
       "      <th>face_type.type</th>\n",
       "      <th>gender.probability</th>\n",
       "      <th>gender.type</th>\n",
       "      <th>location.height</th>\n",
       "      <th>location.left</th>\n",
       "      <th>location.rotation</th>\n",
       "      <th>location.top</th>\n",
       "      <th>location.width</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>31</td>\n",
       "      <td>-5.8</td>\n",
       "      <td>-14.62</td>\n",
       "      <td>-16.19</td>\n",
       "      <td>1</td>\n",
       "      <td>0.43</td>\n",
       "      <td>round</td>\n",
       "      <td>027d8308a2ec665acb1bdf63e513bcb9</td>\n",
       "      <td>1</td>\n",
       "      <td>human</td>\n",
       "      <td>1</td>\n",
       "      <td>male</td>\n",
       "      <td>89</td>\n",
       "      <td>97.35</td>\n",
       "      <td>-13</td>\n",
       "      <td>83.68</td>\n",
       "      <td>99</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   age  angle.pitch  angle.roll  angle.yaw  face_probability  \\\n",
       "0   31         -5.8      -14.62     -16.19                 1   \n",
       "\n",
       "   face_shape.probability face_shape.type                        face_token  \\\n",
       "0                    0.43           round  027d8308a2ec665acb1bdf63e513bcb9   \n",
       "\n",
       "   face_type.probability face_type.type  gender.probability gender.type  \\\n",
       "0                      1          human                   1        male   \n",
       "\n",
       "   location.height  location.left  location.rotation  location.top  \\\n",
       "0               89          97.35                -13         83.68   \n",
       "\n",
       "   location.width  \n",
       "0              99  "
      ]
     },
     "execution_count": 260,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pandas as pd\n",
    "from pandas.io.json import json_normalize\n",
    "data = [{'face_token': '027d8308a2ec665acb1bdf63e513bcb9',\n",
    "    'location': {'left': 97.35,\n",
    "     'top': 83.68,\n",
    "     'width': 99,\n",
    "     'height': 89,\n",
    "     'rotation': -13},\n",
    "    'face_probability': 1,\n",
    "    'angle': {'pitch': -5.8, 'roll': -14.62, 'yaw': -16.19},\n",
    "    'face_shape': {'type': 'round', 'probability': 0.43},\n",
    "    'face_type': {'type': 'human', 'probability': 1},\n",
    "    'age': 31,\n",
    "    'gender': {'type': 'male', 'probability': 1}}]\n",
    "json_normalize(data)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 261,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>age</th>\n",
       "      <th>angle.pitch</th>\n",
       "      <th>angle.roll</th>\n",
       "      <th>angle.yaw</th>\n",
       "      <th>face_probability</th>\n",
       "      <th>face_shape.probability</th>\n",
       "      <th>face_shape.type</th>\n",
       "      <th>face_token</th>\n",
       "      <th>face_type.probability</th>\n",
       "      <th>face_type.type</th>\n",
       "      <th>gender.probability</th>\n",
       "      <th>gender.type</th>\n",
       "      <th>location.height</th>\n",
       "      <th>location.left</th>\n",
       "      <th>location.rotation</th>\n",
       "      <th>location.top</th>\n",
       "      <th>location.width</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>31</td>\n",
       "      <td>-5.8</td>\n",
       "      <td>-14.62</td>\n",
       "      <td>-16.19</td>\n",
       "      <td>1</td>\n",
       "      <td>0.43</td>\n",
       "      <td>round</td>\n",
       "      <td>027d8308a2ec665acb1bdf63e513bcb9</td>\n",
       "      <td>1</td>\n",
       "      <td>human</td>\n",
       "      <td>1</td>\n",
       "      <td>male</td>\n",
       "      <td>89</td>\n",
       "      <td>97.35</td>\n",
       "      <td>-13</td>\n",
       "      <td>83.68</td>\n",
       "      <td>99</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   age  angle.pitch  angle.roll  angle.yaw  face_probability  \\\n",
       "0   31         -5.8      -14.62     -16.19                 1   \n",
       "\n",
       "   face_shape.probability face_shape.type                        face_token  \\\n",
       "0                    0.43           round  027d8308a2ec665acb1bdf63e513bcb9   \n",
       "\n",
       "   face_type.probability face_type.type  gender.probability gender.type  \\\n",
       "0                      1          human                   1        male   \n",
       "\n",
       "   location.height  location.left  location.rotation  location.top  \\\n",
       "0               89          97.35                -13         83.68   \n",
       "\n",
       "   location.width  \n",
       "0              99  "
      ]
     },
     "execution_count": 261,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "result = json_normalize(data)\n",
    "result"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 262,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>年龄</th>\n",
       "      <th>angle.pitch</th>\n",
       "      <th>angle.roll</th>\n",
       "      <th>angle.yaw</th>\n",
       "      <th>face_probability</th>\n",
       "      <th>face_shape.probability</th>\n",
       "      <th>脸型</th>\n",
       "      <th>face_token</th>\n",
       "      <th>face_type.probability</th>\n",
       "      <th>人脸类型</th>\n",
       "      <th>gender.probability</th>\n",
       "      <th>性别</th>\n",
       "      <th>location.height</th>\n",
       "      <th>location.left</th>\n",
       "      <th>location.rotation</th>\n",
       "      <th>location.top</th>\n",
       "      <th>location.width</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>31</td>\n",
       "      <td>-5.8</td>\n",
       "      <td>-14.62</td>\n",
       "      <td>-16.19</td>\n",
       "      <td>1</td>\n",
       "      <td>0.43</td>\n",
       "      <td>圆脸</td>\n",
       "      <td>027d8308a2ec665acb1bdf63e513bcb9</td>\n",
       "      <td>1</td>\n",
       "      <td>人类</td>\n",
       "      <td>1</td>\n",
       "      <td>男性</td>\n",
       "      <td>89</td>\n",
       "      <td>97.35</td>\n",
       "      <td>-13</td>\n",
       "      <td>83.68</td>\n",
       "      <td>99</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   年龄  angle.pitch  angle.roll  angle.yaw  face_probability  \\\n",
       "0  31         -5.8      -14.62     -16.19                 1   \n",
       "\n",
       "   face_shape.probability  脸型                        face_token  \\\n",
       "0                    0.43  圆脸  027d8308a2ec665acb1bdf63e513bcb9   \n",
       "\n",
       "   face_type.probability 人脸类型  gender.probability  性别  location.height  \\\n",
       "0                      1   人类                   1  男性               89   \n",
       "\n",
       "   location.left  location.rotation  location.top  location.width  \n",
       "0          97.35                -13         83.68              99  "
      ]
     },
     "execution_count": 262,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = result.rename ( columns = {\"gender.type\":\"性别\", \n",
    "                       \"age\":\"年龄\",\n",
    "                       \"face_type.type\":\"人脸类型\",\n",
    "                       \"face_shape.type\":\"脸型\",\n",
    "                               } )\n",
    "df.replace({\"male\":\"男性\",\n",
    "              \"human\":\"人类\",\n",
    "              \"round\":\"圆脸\",})"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##### 百度大脑人脸识别总结\n",
    "* 百度大脑的人脸识别与以上两个厂商不同，他需要用获取的client_id和client_secrect运行得到access_token,才能接下去操作人脸识别\n",
    "* 图片的格式应该采用Base64，转换的链接[站长工具](http://tool.chinaz.com/tools/imgtobase)\n",
    "* 百度大脑默认只能识别图片中的一张人脸，默认识别图片中的脸尺寸最大的\n",
    "* 百度大脑可以识别人脸为真人还是卡通人物"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {
    "height": "calc(100% - 180px)",
    "left": "10px",
    "top": "150px",
    "width": "303.542px"
   },
   "toc_section_display": true,
   "toc_window_display": true
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
